import { UploadFileInfo, UploadCustomRequestOptions } from 'naive-ui'

type UploadOptions = {
  file: UploadFileInfo
  fileList: Array<UploadFileInfo>
  event?: Event
}

interface UploadType {
  accept?: string
  maxFileSize?: number
  max?: number
  multiple?: boolean
  showTip?: boolean
  http?: {
    action?: string
    method?: string
    headers?: Record<string, string>
    name?: string
  }
  customRequest?: () => void
  onBeforeUpload?: (options: UploadOptions) => boolean | Promise<boolean>
}

type FileInfo = UploadFileInfo & {
  response?: Record<string, unknown>
  File?: File
  size?: number
}

interface CustomRequestType {
  file: FileInfo
  http?: HttpPropsType
  onError: () => void
  onProgress: (e: { percent: number }) => void
}

interface HttpPropsType {
  action?: string
  method?: string
  headers?: Record<string, string>
  name?: string
  data?: Record<string, string>
}

interface OperateType {
  cancel?: boolean
  delete?: boolean
  retry?: boolean
  download?: boolean
}

export {
  FileInfo,
  UploadOptions,
  UploadType,
  CustomRequestType,
  HttpPropsType,
  OperateType,
  UploadCustomRequestOptions
}
